<extend name="Public:base" />
<!-- 网站标题 -->
<block name="title">用户管理页面</block>
<block name="appendheader">
	<!-- Validform_v5.3.2验证框架 -->
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/Validform/css/Validform_v5.3.2.css"/>
	<link rel="stylesheet" type="text/css" href="css/style.css"  />
	<link rel="stylesheet" type="text/css" href="../Public/css/css.css"  />
	<script type="text/javascript" src="__PUBLIC__/Validform/js/Validform_v5.3.2_min.js"></script>
	<script type="text/javascript">
		function resetVerify() { 
			
			//重载验证码
			var timenow = new Date().getTime();
			$('#verifyImg').attr("src", '__APP__?g=Admin&m=Public&a=verify#'+timenow);
		}
		$(function() {
			var editor;
			var myform = $("#myform").Validform( {
				tiptype:3,
				label:".label",
				showAllError:true,
				postonce:true,	// 开启二次提交防御
				ajaxPost:false,
				beforeSubmit:function(curform) {
					
					// 在验证成功后，表单提交前执行的函数，curform参数是当前表单对象。
					lockScreen();
				},
				callback:function(data) {
					$.Hidemsg();
				}
			});
			myform.addRule([ {
				ele:"#pwd1",
				datatype:"*1-20",
				nullmsg:"请输入6~16位字符的密码！"
			},
			{
				ele:"#pwd2",
				datatype:"*",
				recheck:"pwd1",
				nullmsg:"请再输入一次密码",
				errormsg:"您两次输入的密码不一致！"
			},
			{
				ele:"#verify_code",
				datatype:"*",
				nullmsg:"请输入验证码"
			}]);
		});
		</script>
		
		<script type="text/javascript">
			function CheckIntensity(pwd) { 
				var Mcolor,Wcolor,Scolor,Color_Html; 
			 	var m = 0; 
			 	var Modes = 0; 
			 	for(i=0; i<pwd.length; i++) { 
			  		var charType=0; 
			  		var t = pwd.charCodeAt(i); 
			  		if(t >= 48 && t <= 57) { charType = 1;} 
			  		else if(t >= 65 && t <= 90) {charType = 2;} 
			  		else if(t >= 97 && t <= 122) {charType = 4;} 
			  		else { charType = 4;} 
			  		Modes |= charType; 
			 	} 
				for(i=0;i<4;i++) { 
					if(Modes & 1){m++;} 
					Modes >>>= 1; 
			 	} 
			 	if(pwd.length <= 4) { m = 1; } 
			 	if(pwd.length <= 0) { m = 0; } 
			 	switch(m) { 
				case 1 : 
					Wcolor = "pwd pwd_Weak_c"; 
					Mcolor = "pwd pwd_c"; 
					Scolor = "pwd pwd_c pwd_c_r"; 
					Color_Html = "弱"; 
					break; 
				case 2 : 
					Wcolor = "pwd pwd_Medium_c"; 
					Mcolor = "pwd pwd_Medium_c"; 
					Scolor = "pwd pwd_c pwd_c_r"; 
					Color_Html = "中";
					break; 
				case 3 : 
					Wcolor = "pwd pwd_Strong_c"; 
					Mcolor = "pwd pwd_Strong_c"; 
					Scolor = "pwd pwd_Strong_c pwd_Strong_c_r"; 
					Color_Html = "强"; 
					break; 
			  	default : 
					Wcolor = "pwd pwd_c"; 
					Mcolor = "pwd pwd_c pwd_f"; 
					Scolor = "pwd pwd_c pwd_c_r"; 
					Color_Html = "无"; 
					break; 
			 	} 
			  	document.getElementById('pwd_Weak').className=Wcolor; 
			  	document.getElementById('pwd_Medium').className=Mcolor; 
			  	document.getElementById('pwd_Strong').className=Scolor; 
			  	document.getElementById('pwd_Medium').innerHTML=Color_Html; 
			}
		</script>
</block>
<!-- 网页主内容区 -->
<block name="main_content">
	<div class="row">
		<div class="col-md-12">
			<div class="panel panel-blue">
				<div class="panel-heading">修改密码</div>
				<div class="panel-body pan">
					<form id="myform" name="myform" action="__APP__?g={:GROUP_NAME}&m={:MODULE_NAME}&a=update_pwd" method="post" class="form-horizontal form-seperated">
						<div class="form-body">
							<div class="form-group">
								<label for="pwd" class="col-md-2 control-label">旧密码<span class='require'>*</span></label>
								<div class="col-md-4">
									<input type="password" id="pwd" name="pwd" class="form-control" />
								</div>
							</div>	
							<div class="form-group">
								<label for="pwd" class="col-md-2 control-label">新密码<span class='require'>*</span></label>
								<div class="col-md-4">
									<span class="tbl-txt"><input type="password" id="pwd1" name="pwd1"  value="{$data.pwd}" class="form-control"  onKeyUp="CheckIntensity(this.value)"/></span>	 
									<table border="0" cellpadding="0" cellspacing="0" style="margin-top:10px;"> 
										<tr align="center"> 
											<td id="pwd_Weak" class="pwd pwd_c"></td> 
											<td id="pwd_Medium" class="pwd pwd_c pwd_f">无</td> 
											<td id="pwd_Strong" class="pwd pwd_c pwd_c_r"> </td> 
										</tr> 
									</table> 
								</div>
							</div>
							<div class="form-group">
								<label for="pwd" class="col-md-2 control-label">确认密码<span class='require'>*</span></label>
								<div class="col-md-4">
									<input type="password" id="pwd2" name="pwd2" class="form-control" />
								</div>
							</div>
							<div class="form-group">
								<label  class="col-md-2 control-label">验证码<span class='require'>*</span></label>
								<div class="col-md-4">
									<input type="text" placeholder="请输入验证码"  id="verify_code" name="verify_code" class="form-control" />
								</div>
								<div  class="col-md-5">
									<img id="verifyImg" src="__APP__?g=Admin&m=Public&a=verify" onClick="javascript:resetVerify()" alt="点击刷新验证码" />
								</div>
							</div>
							<div class="form-actions text-left">
								<div class="col-md-offset-2 col-md-7">
									<input type="hidden" name="id" value="{$Think.session.userid}" />
									<button type="submit" class="btn btn-primary">提交 </button>&nbsp;&nbsp;
									<button type="button" class="btn btn-green" onclick="history.go(-1);">取消</button>
								</div>
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
</block>